/**
 * @FileName editorDefaultConfig
 * @Description
 * @Author renminghe
 * @Date 2018-12-24 10:53
 * @Version 1.0
 * @Copyright(c) gome inc Gome Co.,LTD
 **/

export default {
    light: {
        AmbientLight: {name: "环境光"},
        DirectionalLight: {name: "平行光"},
        PointLight: {name: "点光源"},
        SpotLight: {name: "聚光灯",},
        HemisphereLight: {name: "半球光"},
        RectAreaLight: {name: "面积光"},
    },

    entry_scene: {
        entry_scene: {name: "场景"}
    },

    camera: {
        PerspectiveCamera: {name: "自由相机"},
        OrthographicCamera: {name: "透视相机"},
    },

    // 编辑器属性中文名
    categoryParamsNameMap: {
        position: "坐标",
        rotation: "旋转",
        scale: "缩放",
        shadow: "Shadow",
        color: "颜色",
        weight: "强度",
        name: "名称",
        type: "类型",
    },

    categoryLocation: [
        {type: "entry_scene", index: 0, childrens: []},
        {
            type: "light",
            index: 1,
            childrens: {
                "AmbientLight": 0,
                "DirectionalLight": 1,
                "PointLight": 2,
                "SpotLight": 3,
                "HemisphereLight": 4,
                "RectAreaLight": 5
            },
        },
        {   type: "camera",
            index: 2,
            childrens: {
                "PerspectiveCamera": 0,
                "OrthographicCamera": 1,

            }
        },
        {type: "model", index: 3, childrens: []},
        {
            type: "material",
            index: 4,
            childrens: {
                "MeshBasicMaterial": 0,
                "MeshPhongMaterial": 1,
                "MeshPhysicalMaterial": 2,
                "MeshStandardMaterial": 3,
                "MeshToonMaterial": 4,
            }
        },
        {
            type: "geo",
            index: 5,
            childrens: {}
        },
        {type: "textures", index: 6, childrens: []},
        {type: "text", index: 7, childrens: []},
    ],

    // 撤回操作队列数
    cancelCount: 5,

    getCategoryName(type, paramStr) {

        if (type === 'light' || type === 'entry_scene' || type === 'camera') {

            return this[type][paramStr] ? this[type][paramStr].name : paramStr;
        }

        return paramStr;
    },

    /**
     * @Author renminghe
     * @Description //通过分类名字以及分类下子类名找到其子类在其父分类中的名字
     * @Date 11:50 2019-01-02
     * @Param type String 父级类名
     * @Param childName String 子类名
     * @return Number
     **/
    getChildNameByTypeAndChildIndex (type, childIndex) {

        let i = 0;
        for (i; i < this.categoryLocation.length; i++) {

            if (this.categoryLocation[i].type === type) {

                const categoryChildrensMap = this.categoryLocation[i].childrens;

                let findres = -1;

                Object.keys(categoryChildrensMap).forEach((k, v) => {

                    if (childIndex === v) {

                        findres = k;
                    }
                });

                return findres;
            }
        }

        return -1;
    },


    /**
     * @Author renminghe
     * @Description //通过分类名字以及分类下子类名找到其子类在其父分类中的位置
     * @Date 11:50 2019-01-02
     * @Param type String 父级类名
     * @Param childName String 子类名
     * @return Number
     **/
    getChildIndexByTypeAndChildName (type, childName) {

        let i = 0;
        for (i; i < this.categoryLocation.length; i++) {

            if (this.categoryLocation[i].type === type) {

                const categoryChildrensMap = this.categoryLocation[i].childrens;

                let findres = -1;

                Object.keys(categoryChildrensMap).forEach((k, v) => {

                    if (childName === k) {

                        findres = v;
                    }
                });

                return findres;
            }
        }

        return -1;
    },

    haloVersion: {
        "new": "1.8",
        "1.8": "1.8",
        "1.7": "1.7",
        "1.6": "1.6",
        "1.5": "1.5",
        "1.4": "1.4",
        "1.3": "1.3",
        "1.2": "1.2",
        "1.1": "1.1",
    },
}